<p class="Head1"><help:key-word value="queries; creating and editing" tag="kw66196_1"/><help:link Id="66196">Queries</help:link></p>
<p class="Paragraph">Queries are special views of tables, which can, for example, display certain records or only a few fields per record and if required also sort those records. A query can be for one table as well as for multiple tables, if they are linked by common data fields.</p>
<p class="Paragraph">Use queries to find records from data tables based on certain criteria. All queries created for a database are listed under the <span class="T1">Queries</span> entry. Since this entry contains the database queries, it is also called the "query container".</p>
<p class="Paragraph">For printing a query or table do the following:</p>
<ol class="L1">
<li class="">
<p class="P2">Open a text document (or a spreadsheet document if you prefer the specific printing functions of this type of document).</p>
</li>
<li class="">
<p class="P2">Open the database so that you can see the name of the query or table as an entry.</p>
</li>
<li class="">
<p class="P2">Drag the name into the open document. You now see the dialog <help:link Id="65967" xmlns:help="http://openoffice.org/2000/help">Insert Database Columns</help:link></p>
</li>
<li class="">
<p class="P2">Decide which columns = data fields you want to include. You can also click the AutoFormat button and select a corresponding formatting. Close the dialog.</p>
</li>
</ol>
<p class="Paragraph">The query or table will be inserted in your document. If you want, you can perform further modifications and print the document.</p>
<p class="Paragraph">You can also select the entire database table in the data source view (button in the top left corner of the table) and then drag this to a text document or spreadsheet.</p>
</span></td></tr></table>
<p class="Paragraph">The <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Help provides you with further information about the following subjects:</p>
<p class="Head2"><help:link Id="67914" xmlns:help="http://openoffice.org/2000/help">Creating a New Query</help:link></p>
<p class="Paragraph">In the context menu of a query container open the command <span class="T1">New</span>.</p>
<p class="Paragraph">The query design window offers you all the possibilities to query tables. A SQL command will be interactiv generated which you can also reedit manually.</p>
<p class="Paragraph">You can perform calculations with the data of a table and store the results as a query result.</p>
<p class="Head2"><help:link Id="66162" Eid="sql" xmlns:help="http://openoffice.org/2000/help"><help:productname>%PRODUCTNAME</help:productname> and SQL</help:link></p>
<p class="Paragraph"><help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> "understands" SQL. The syntax used depends on the database system you are using.</p>